﻿#pragma once

/// CEGUI和Ogre的GUI渲染器头文件包含

#include <CEGUIImageset.h>
#include <CEGUISystem.h>
#include <CEGUILogger.h>
#include <CEGUISchemeManager.h>
#include <CEGUIWindowManager.h>
#include <CEGUIWindow.h>
#include <CEGUIEvent.h>
#include <CEGUIPropertyHelper.h>
#include <CEGUIFontManager.h>
#include <elements/CEGUICombobox.h>
#include <elements/CEGUIListbox.h>
#include <elements/CEGUIListboxTextItem.h>
#include <elements/CEGUIPushButton.h>
#include <elements/CEGUIScrollbar.h>
#include <elements/CEGUIRadioButton.h>
#include <elements/CEGUIEditbox.h>
#include <elements/CEGUIMultiColumnList.h>
#include <elements/CEGUIMultiColumnListProperties.h>
#include <OgreCEGUIRenderer.h>
#include <OgreCEGUIResourceProvider.h>

// 
//// 多场景管理器
//#include "ExampleApplication.h"
//// 定义摄像机的名称，公用
//#define CAMERA_NAME "SceneCamera"
//// 单屏显示整个场景
//void setupViewport(RenderWindow *win, SceneManager *curr)
//{
//	win->removeAllViewports();
//	Camera *cam = curr->getCamera(CAMERA_NAME);// 取得当前摄像机
//	Viewport *vp = win->addViewport(cam);// 为当前摄像机添加视口
//	vp->setBackgroundColour(ColourValue(0, 0, 0));// 设置视口背景色
//	cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));// 设置视口纵宽比
//}
//// 同时显示两个场景
//void dualViewport(RenderWindow *win, SceneManager *primary, SceneManager *secondary)
//{
//	win->removeAllViewports();
//	Viewport *vp = 0;
//	Camera *cam = primary->getCamera(CAMERA_NAME);
//	vp = win->addViewport(cam, 0, 0, 0, 0.5, 1);
//	vp->setBackgroundColour(ColourValue(0, 0, 0));
//	cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
//	cam = secondary->getCamera(CAMERA_NAME);
//	vp = win->addViewport(cam, 1, 0.5, 0, 0.5, 1);
//	vp->setBackgroundColour(ColourValue(0, 0, 0));
//	cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
//}
//class SMTutorialListener : public ExampleFrameListener, public OIS::KeyListener
//{
//public:
//	SMTutorialListener(RenderWindow* win, SceneManager *primary, SceneManager *secondary)
//		: ExampleFrameListener(win, primary->getCamera(CAMERA_NAME), true, false),
//		mPrimary(primary), mSecondary(secondary), mDual(false), mContinue(true)
//	{// 初始化各个参数，使用带缓冲的键盘输入
//		mKeyboard->setEventCallback(this);
//	}
//	bool frameStarted(const FrameEvent& evt)
//	{
//		mKeyboard->capture();// 捕获键盘信息
//		return mContinue;
//	}
//	bool keyPressed(const OIS::KeyEvent &arg)
//	{
//		switch (arg.key)
//		{
//		case OIS::KC_ESCAPE:
//			mContinue = false;
//			break;// ESC键退出
//		case OIS::KC_V:
//			mDual = !mDual;// 状态切换
//			if (mDual)
//			{
//				dualViewport(mWindow, mPrimary, mSecondary);
//			}
//			else
//			{
//				setupViewport(mWindow, mPrimary);
//			}
//			break;
//		case OIS::KC_C:
//			// 交换两个场景管理器
//			swap(mPrimary, mSecondary);
//			if (mDual)
//			{
//				dualViewport(mWindow, mPrimary, mSecondary);
//			}
//			else
//			{
//				setupViewport(mWindow, mPrimary);
//			}
//			break;
//		default:
//			break;
//		}
//		return true;
//	}
//	bool keyReleased(const OIS::KeyEvent &) {return true;}
//private:
//	SceneManager *mPrimary, *mSecondary;
//	bool mDual, mContinue;
//	// 交换场景管理器
//	static void swap(SceneManager *&first, SceneManager *&second)
//	{
//		SceneManager *tmp = first;
//		first = second;
//		second = tmp;
//	}
//};
//class SMTutorialApplication : public ExampleApplication
//{
//public:
//	SMTutorialApplication()
//	{
//	}
//	~SMTutorialApplication() 
//	{
//	}
//protected:
//	SceneManager *mPrimary, *mSecondary;
//	void chooseSceneManager(void)
//	{
//		// 在Root下创建两个场景管理器
//		mPrimary = mRoot->createSceneManager(ST_GENERIC, "primary");
//		mSecondary = mRoot->createSceneManager(ST_GENERIC, "secondary");
//	}
//	void createCamera()
//	{
//		// 为两个场景管理器创建摄像机
//		mPrimary->createCamera(CAMERA_NAME);
//		mSecondary->createCamera(CAMERA_NAME);
//	}
//	void createViewports()
//	{
//		// 为第一个场景管理器创建视口
//		setupViewport(mWindow, mPrimary);
//	}
//	void createScene(void)
//	{
//		// 为两个场景管理器设置天空盒和天空穹
//		mPrimary->setSkyBox(true, "Examples/SpaceSkyBox");
//		mSecondary->setSkyDome(true, "Examples/CloudySky", 5, 8);
//	}
//	void createFrameListener(void)
//	{
//		// 创建帧监听器
//		mFrameListener = new SMTutorialListener(mWindow, mPrimary, mSecondary);// 传入两个场景管理器
//		mFrameListener->showDebugOverlay(true);
//		mRoot->addFrameListener(mFrameListener);
//	}
//};
//#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
//#define WIN32_LEAN_AND_MEAN
//#include "windows.h"
//INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
//#else
//int main(int argc, char **argv)
//#endif
//{
//	// Create application object
//	SMTutorialApplication app;
//	try {
//		app.go();
//	} catch(Exception& e) {
//#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
//		MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
//#else
//		fprintf(stderr, "An exception has occurred: %s\n",
//			e.getFullDescription().c_str());
//#endif
//	}
//	return 0;
//}